﻿namespace JobButenko.Models.BusinessLogicLayer
{
    using System.Collections.Generic;
    using System.Linq;

    public class PostRepository
    {
        private readonly JobDataContext dataContext;

        public PostRepository(JobDataContext dataContext)
        {
            this.dataContext = dataContext;
        }

        public List<Post> GetPost()
        {
            return this.dataContext.Posts.OrderBy(post => post.PostId).ToList();
        }

        public List<Post> GetPostId(int profFieldId)
        {
            return this.dataContext.Posts.Where(post => post.ProfFieldId.Equals(profFieldId)).ToList();
        }
    }
}